/**
 * 质控项目操作日志表管理初始化
 */
var SdsMatchLog = {
    id: "SdsMatchLogTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
SdsMatchLog.initColumn = function () {
    return [
        {title: '对照类型', field: 'matchType', width:100, align: 'left', valign: 'middle', sortable: false},
        {title: '标准字典', field: 'dicDesc', width:240, align: 'left', valign: 'middle', sortable: false},
        {title: '操作类型', field: 'operType', width:40, align: 'center', valign: 'middle', sortable: false, formatter: function (value, row, index){
                var _html="";
                switch (value) {
                    case 1:
                        _html="对照";
                        break;
                    case 2:
                        _html="撤销";
                        break;
                    default:
                        break;
                }
                return _html;
            }},
        {title: '对照业务数据', field: 'operContent', width:150, align: 'left', valign: 'middle', sortable: false},
        {title: '操作日期', field: 'operTime', width:100, align: 'center', valign: 'middle', sortable: false},
        {title: '操作人', field: 'operUser', width:80, align: 'center', valign: 'middle', sortable: false}];
};

/**
 * 检查是否选中
 */
SdsMatchLog.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Sys.info("请先选中表格中的某一记录！");
        return false;
    }else{
        SdsMatchLog.seItem = selected[0];
        return true;
    }
};

/**
 * 查询质控项目操作日志表列表
 */
SdsMatchLog.search = function () {
    var queryData = {};
    queryData['dicDesc'] = $("#dicDesc").val();
    queryData['operType'] = $("#operType").combobox("getValue");
    SdsMatchLog.table.refresh({query: queryData, pageNumber: 1});
};

$(function () {
    var defaultColunms = SdsMatchLog.initColumn();
    var table = new BSTable(SdsMatchLog.id, Sys.backendPath + "/sds/sdsstddicmatchlog/list", defaultColunms);
    table.setPaginationType("server");
    table.setPageSize(15);
    var b_height = document.documentElement.clientHeight;
    table.setHeight(b_height-62);
    SdsMatchLog.table = table.init();
});
